﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BenevolentSun
{
    class LoadProfileScreen : LoadingScreen
    {

        public override void LoadContent()
        {
            Session.OnLoaded += new EventHandler(Session_OnLoaded);
            Session.LoadSession();

            base.LoadContent();
        }

        void Session_OnLoaded(object sender, EventArgs e)
        {
            Console.WriteLine("Loaded");
            
            Session.OnLoaded -= this.Session_OnLoaded;

            Session.OnRecordsLoaded += new EventHandler(Session_OnRecordsLoaded);
            Session.LoadRecords();
        }

        void Session_OnRecordsLoaded(object sender, EventArgs e)
        {
            Console.WriteLine("Loaded Records");
            
            Session.OnRecordsLoaded -= this.Session_OnRecordsLoaded;

            ScreenManager.AddScreen(new MainMenuScreen());
            ExitScreen();
        }

    }
}
